package org.imsetal.ilpointservice.controller;

import jakarta.annotation.Resource;
import org.imsetal.ilapi.utils.Result;
import org.imsetal.ilpointservice.service.UserPointService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

@RestController
@RequestMapping("userPoint")
public class UserPointController {
    @Resource
    UserPointService userPointService;

    @GetMapping("")
    public Result getUserPoint(Long userid) {
        int point=userPointService.selectUserPoint(userid);
        return Result.success(point);
    }

    @GetMapping("/tryCheckUserExist")
    public Mono<Result> tryCheckUserExist(Long userid) {
        return userPointService.tryToCheckUserExist(userid)
                .map(Result::success);
    }
}
